package com.niit.feign.fallback;

import com.niit.feign.clients.UserClient;
import com.niit.feign.pojo.User;
import org.springframework.stereotype.Component;


import java.util.UUID;
/**
 * UserClient 统一自定义服务降级方法
 * @author yaojianfeng
 */
//@Component
public class UserClientFallback implements UserClient {
    @Override
    public User findUserById(String id) {
        User user = new User();
        user.setUsername("findUserById 调用失败");
        user.setId(UUID.randomUUID().toString());
        return user;
    }

    @Override
    public String requestParam(String name) {
        return "requestParam 调用失败";
    }

    @Override
    public User headerInfo(String name, String address) {
        User user = new User();
        user.setUsername("headerInfo 调用失败");
        user.setId(UUID.randomUUID().toString());
        return user;
    }

    @Override
    public String bodyInfo(User user) {
        return "bodyInfo 调用失败";
    }
}
